﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Pansoft.HIME.Base.Abstracts;
using Pansoft.HIME.Base.Entities;
using Pansoft.HIME.Base.Enums;

namespace Pansoft.HIME.Base.ViewModels
{
    public class OrganizationViewModel : SimpleViewModel<Organization>
    {
        public string id { get; set; }
        public string pId { get; set; }
        public OrganizationCategory category { get; set; }
        public string name { get; set; }

        /// <summary>实体的创建时间
        /// </summary>
        public DateTime createdTime { get; set; }

        /// <summary>实体的修改时间
        /// </summary>
        public DateTime modifiedTime { get; set; }

        /// <summary>实体的创建人的ID
        /// </summary>
        public string createrId { get; set; }

        /// <summary>实体的修改人的ID
        /// </summary>
        public string menderId { get; set; }

        /// <summary>实体是否是被删除状态
        /// </summary>
        public bool isDeleted { get; set; }

        /// <summary>当转换成比较两个实体的属性是否相同
        /// </summary>
        protected override bool Compare(PropertyInfo vmPi, PropertyInfo entityPi)
        {
            if (vmPi.Name == "pId" && entityPi.Name == "ParentId")
                return true;
            return vmPi.Name.ToLower() == entityPi.Name.ToLower();
        }
    }
}
